summaryrefslogtreecommitdiff
path: root/src/pages/shop/category/[slug].jsx
diff options
context:
space:
mode:
authorFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2026-01-30 09:28:19 +0700
committerFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2026-01-30 09:28:19 +0700
commit0df8e2dc0771853eac3e3db2a3716042681c876e (patch)
tree38d8794ad57de6c470f31376f68658d3e21cc26f /src/pages/shop/category/[slug].jsx
parent4bb444b880d7677ba60f163c78440c2357fb16a4 (diff)
parentec7ab4c654fc5b29b277d42ad84986f4c1220134 (diff)
fix merge
Diffstat (limited to 'src/pages/shop/category/[slug].jsx')
-rw-r--r--src/pages/shop/category/[slug].jsx30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/pages/shop/category/[slug].jsx b/src/pages/shop/category/[slug].jsx
index 11840d47..e515e3f4 100644
--- a/src/pages/shop/category/[slug].jsx
+++ b/src/pages/shop/category/[slug].jsx
@@ -16,13 +16,14 @@ const ProductSearch = dynamic(() =>
);
const CategorySection = dynamic(() =>
import('@/lib/product/components/CategorySection')
-)
+);
export default function CategoryDetail() {
const router = useRouter();
const { slug = '', page = 1 } = router.query;
- const [dataCategories, setDataCategories] = useState([])
+ const [dataCategories, setDataCategories] = useState([]);
+ const [shortDesc, setShortDesc] = useState('');
const categoryName = getNameFromSlug(slug);
const categoryId = getIdFromSlug(slug);
const q = router?.query.q || null;
@@ -33,6 +34,22 @@ export default function CategoryDetail() {
if (q) {
query.q = q;
}
+ useEffect(() => {
+ if (!router.isReady) return;
+ if (!categoryId) return;
+
+ const loadShortDesc = async () => {
+ const res = await odooApi(
+ 'GET',
+ `/api/v1/category/${categoryId}/short-desc`
+ );
+
+ const desc = res?.shortDesc || '';
+ setShortDesc(desc);
+ };
+
+ loadShortDesc();
+ }, [router.isReady, categoryId]);
return (
<BasicLayout>
@@ -47,11 +64,14 @@ export default function CategoryDetail() {
]}
/>
- <Breadcrumb categoryId={categoryId} />
-
+ <Breadcrumb categoryId={categoryId} shortDesc={shortDesc} />
{!_.isEmpty(router.query) && (
- <ProductSearch query={query} categories ={categoryId} prefixUrl={`/shop/category/${slug}`} />
+ <ProductSearch
+ query={query}
+ categories={categoryId}
+ prefixUrl={`/shop/category/${slug}`}
+ />
)}
</BasicLayout>
);